#pragma once

#include <QWidget>
#include <QtWidgets/QMainWindow>
#include "confirm.h"
#include "const.h"
#include "httpcommon.h"
#include "ui_resourceitem.h"
#include "log.h"

class ResourceItem : public QWidget
{
	Q_OBJECT

public:
	ResourceItem(QString id, QString name, QString time, QString type, double size, int status, QString recordID, QWidget *parent = Q_NULLPTR);
	~ResourceItem();
	void setChecked(bool checked);
	void download();
	public Q_SLOTS:
	void on_pbDelete_clicked();
	void on_pbDownload_clicked();
	void on_pbPublish_clicked();
	void on_cbCheck_clicked();
	protected:
	void enterEvent(QEvent *event);
	void leaveEvent(QEvent *event);
	bool eventFilter(QObject* obj, QEvent* e);
	private Q_SLOTS:
	void confirmOKSlot();
Q_SIGNALS:
	void downloadSignal(QString, QString, bool);
	void deleteSignal(QString, QString);
	void enterDirSignal(QString, QString);
	void checkSignal(QString, bool);
private:
	void initWidgetValue();
private:
	Ui::ResourceItem ui;
	QString m_id;
	QString m_name;
	QString m_time;
	QString m_type;
	double m_size;
	int m_status;
	QString m_size_show;
	QString m_status_show;
	QString m_type_show;
	QString m_recordID;
};
